package com.hdax.search.controller;

import com.hdax.search.service.MillSeatchService;
import com.hdax.search.vo.SearchResult;
import com.hdax.search.vo.SeatchParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class SearchController {


    @Autowired
    private MillSeatchService millSeatchService;

    /**
     * 检索商品条件(渲染到搜索页面)
     * @param seatchParam
     * @return
     */
    //SeatchParam seatchParam封装的查询条件
    @GetMapping("/list.html")
    public String listPage(SeatchParam seatchParam, Model model){
        SearchResult search= millSeatchService.search(seatchParam);
        model.addAttribute("result",search);
        return "list";
    }
}
